@import 'theme';
$defaultColor: $bg;
$hoverColor: $secondary;
$activeColor: $headerBg;
$shadow: $shadow;
$white: $headerFg;
$lesscolor: $secondaryFg;
$acolor: $fg;
@mixin active() {
    background: $activeColor;
    color: $white;
}

@mixin hover() {
    background: $hoverColor;
    color: $white;
}

@import './markdown';
@import './daily';

* {
    padding: 0;
    margin: 0;
}

.book-skin {
    position: relative;
    width: 1200px;
    margin: 0 auto;
    min-height: 300px;
    a {
        text-decoration: none;
        color: $acolor;
    }
    .book-title {
        line-height: 100px;
        text-align: center;
        .book-nav {
            >li {
                list-style: none;
                display: none;
                &.active {
                    display: inline-block;
                    font-size: 30px;
                    line-height: 40px;
                }
                &.book-back {
                    position: absolute;
                    left: 0;
                }
                &.book-navicon {
                    display: none;
                }
                &.book-search {
                    position: absolute;
                    right: 0;
                    .fa {
                        position: absolute;
                        top: 40px;
                        left: 5px;
                        font-size: 20px;
                        color: $defaultColor;
                    }
                    input {
                        font-size: 20px;
                        padding-left: 25px;
                        background: transparent;
                        border: 1px solid $defaultColor;
                        display: none;
                    }
                    .search-tip {
                        position: absolute;
                        top: 63px;
                        z-index: 99;
                        line-height: 25px;
                        background: $defaultColor;
                        width: 100%;
                        display: none;
                        li {
                            list-style: none;
                            &:hover {
                                @include active();
                                a {
                                    color: $white;
                                }
                            }
                        }
                    }
                    input:focus+.search-tip,
                    &.focus .search-tip {
                        display: block;
                    }
                    &.focus input {
                        display: inline-block;
                    }
                }
            }
            &:hover,
            &.hover {
                >li {
                    display: inline-block;
                    &.book-navicon {
                        display: none;
                    }
                }
            }
        }
    }
    .book-body {
        margin-right: 200px;
        background-color: $defaultColor;
        padding: 30px 15px;
        min-height: 400px;
        position: relative;
        .book-fork {
            img {
                position: absolute;
                top: 0;
                right: 0;
                border: 0;
                z-index: 99;
            }
        }
        .book-header {
            font-size: 16px;
            line-height: 40px;
            border-bottom: 1px solid #eee;
            color: #484848;
            font-weight: normal;
            margin-bottom: 10px;
            &::after {
                display: block;
                content: " ";
                background: #000;
                width: 60px;
                height: 3px;
            }
        }
        .book-term {
            .term-info {
                position: relative;
                min-height: 50px;
                img {
                    width: 100%;
                }
                h3 {
                    position: absolute;
                    bottom: 4px;
                    line-height: 50px;
                    display: block;
                    background: rgba(0, 0, 0, 0.6);
                    width: 100%;
                    color: $white;
                    padding: 0 10px;
                    box-sizing: border-box;
                }
            }
            margin-bottom: 20px;
        }
        .book-sort {
            position: absolute;
            right: 25px;
            top: -30px;
            a {
                display: inline-block;
                width: 50px;
                line-height: 30px;
                text-align: center;
                position: relative;
                background: $defaultColor;
                &:after {
                    position: absolute;
                    content: "";
                    width: 0;
                    height: 0;
                    left: 0;
                    bottom: -50px;
                    border: transparent 25px solid;
                    border-top-color: rgba($activeColor, .6);
                }
                &.active {
                    @include active();
                    &:after {
                        border-top-color: $activeColor;
                    }
                }
            }
        }
        .book-item {
            margin: 0 -15px;
            padding: 15px 20px 5px;
            animation-duration: 1.5s;
            animation-timing-function: linear;
            transition: box-shadow 1s;
            dt {
                font-size: 20px;
                font-weight: 600;
                .book-time {
                    float: right;
                    text-align: right;
                }
            }
            dd {
                //display: none;
                p {
                    margin: 5px 0;
                    min-height: 40px;
                }
                .author,
                .comment,
                .category,
                .language {
                    margin-right: 20px;
                }
                .agree,
                .disagree {
                    float: right;
                    margin-left: 10px;
                }
            }
            &:hover,
            &:nth-child(2),
            &:nth-child(3),
            &:nth-child(4) {
                dd {
                    display: block;
                }
            }
            &:hover {
                box-shadow: $shadow 0 0 10px ;
            }
            &:not(:last-child) {
                border-bottom: 1px solid $activeColor;
            }
            &.fade-pre-item {
                visibility: hidden;
            }
            &.fade-item {
                animation-name: fadeInLeft;
                background: $defaultColor;
                border-bottom: none;
                visibility: visible;
            }
        }
        .cat-item {
            line-height: 40px;
            .count {
                color: #bbb;
            }
        }
        .tag-item {
            margin: 5px 10px;
            border-bottom: 1px solid #999;
            &:hover {
                border-bottom: 1px solid #333;
            }
        }
        .info {
            border-bottom: 1px dotted $activeColor;
            line-height: 40px;
            span,
            a {
                margin-right: 20px;
                color: $acolor;
            }
            .language-toggle {
                display: inline-block;
                margin-right: 20px;
                border: 1px solid $activeColor;
                border-bottom: none;
                a {
                    display: inline-block;
                    background-color: $activeColor;
                    color: $white;
                    margin: 0;
                    width: 40px;
                    text-align: center;
                    &.active {
                        background-color: $defaultColor;
                        color: $acolor;
                        position: relative;
                        &::after {
                            position: absolute;
                            content: "";
                            display: block;
                            background-color: #fff;
                            width: 40px;
                            height: 3px;
                        }
                    }
                }
            }
        }
        .content {
            margin-bottom: 40px;
            max-height: 300px;
            overflow-y: hidden;
            a {
                color: #06a;
            }
        }
        .toggle-open {
            background-color: rgba(255, 255, 255, .9);
            line-height: 40px;
            text-align: center;
            position: absolute;
            left: 0;
            right: 0;
            bottom: 60px;
            color: #777;
            cursor: pointer;
        }
        .tools {
            border-top: 1px dotted $activeColor;
            line-height: 40px;
            position: absolute;
            bottom: 0;
            right: 15px;
            left: 15px;
            font-size: 20px;
            span {}
            .agree,
            .disagree {
                float: right;
                margin-left: 20px;
            }
        }
        .book-source,
        .book-tags {
            font-size: 14px;
            font-weight: 100;
            margin-top: 10px;
            a {
                color: #0474c8;
                font-weight: 600;
            }
        }
        .book-bottom {
            margin-bottom: 20px;
        }
        &.open {
            .content {
                max-height: inherit;
            }
            .toggle-open {
                display: none;
            }
        }
    }
    .book-footer {
        
        &.comment {
            margin-top: 50px;
            margin-right: 200px;
            background: $defaultColor;
            padding: 15px;
            position: relative;
        }
        
    }
    
}

.time-axis {
    position: relative;
    z-index: 1010;
    margin-left: 55px;
    .time-title {
        position: relative;
        margin: 60px 0;
        .time-year {
            margin-left: 20px;
            font-size: 20px;
            font-weight: 700;
            line-height: 1.5;
        }
        &::before {
            content: " ";
            position: absolute;
            left: 0;
            top: 50%;
            margin-left: -4px;
            margin-top: -4px;
            width: 8px;
            height: 8px;
            background: #bbb;
            border-radius: 50%;
        }
    }
    .time-items {
        margin: 30px 0;
        .time-item {
            display: block;
            position: relative;
            transition-duration: .2s;
            transition-timing-function: ease-in-out;
            transition-delay: 0s;
            transition-property: border;
            border-bottom: 1px dashed #ccc;
            line-height: 40px;
            .title {
                margin-left: 60px;
                font-size: 16px;
                font-weight: 400;
                line-height: inherit;
            }
            .time {
                position: absolute;
                font-size: 12px;
                left: 20px;
                top: 0px;
            }
            &::before {
                content: " ";
                position: absolute;
                left: 0;
                top: 17px;
                width: 6px;
                height: 6px;
                margin-left: -4px;
                background: #bbb;
                border-radius: 50%;
                border: 1px solid #fff;
                transition-duration: .2s;
                transition-timing-function: ease-in-out;
                transition-delay: 0s;
                transition-property: background;
            }
            &:hover {
                border-bottom-color: #666;
                &::before {
                    background: #222;
                }
            }
        }
    }
    &:after {
        content: " ";
        position: absolute;
        top: 20px;
        left: 0;
        margin-left: -2px;
        width: 4px;
        height: 100%;
        background: #f5f5f5;
        z-index: -1;
    }
}

.book-pager {
    float: left;
    li {
        list-style: none;
        background: $defaultColor;
        width: 40px;
        line-height: 40px;
        text-align: center;
        float: left;
        border-top: 1px dotted $activeColor;
        a {
            display: block;
        }
        
        &.active {
            @include active();
        }
        &:hover {
            font-weight: 700;
            a {
                color: #af5d0d;
            }
        }
    }
}

.book-navigation {
    padding: 30px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 10px;
    .prev,
    .next {
        display: grid;
        grid-template-columns: 30px 1fr;
        white-space: nowrap;
        .fa {
            padding: 13px 0 0 10px;
            color: #7a7a7a;
            font-size: 20px;
            display: inline-block;
        }
        .prev-text,
        .next-text {
            display: inline-block;
            overflow: hidden;
        }
        .prev-label,
        .next-label {
            font-size: .8em;
        }
        .prev-title,
        .next-title {
            display: block;
            color: #0c0c0c;
            font-size: 18px;
            font-weight: 400;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }
    .next {
        text-align: right;
        grid-template-columns: 1fr 30px;
        .fa {
            padding: 13px 10px 0 0;
        }
    }
}

.book-comments {
    .reply-hide {
        display: none;
    }
    .title {
        font-size: 20px;
        border-left: 5px solid $activeColor;
        padding-left: 10px;
        margin-top: 15px;
        .order {
            float: right;
            font-size: 12px;
            cursor: pointer;
            .active {
                color: #f00;
            }
        }
    }
    .comment-item {
        padding: 8px 0;
        
        position: relative;
        .info {
            line-height: 30px;
            .user {
                font-weight: 600;
            }
            .time {
                margin-left: 20px;
                color: $lesscolor;
            }
            .floor {
                float: right;
            }
        }
        .content {
            p {
                margin: 5px 0;
            }
            .expand {
                font-size: 12px;
            }
            .comment,
            .report {
                float: right;
                margin-left: 20px;
            }
        }
        .actions {
            position: absolute;
            right: -215px;
            width: 200px;
            text-align: center;
            top: 30px;
            background: $defaultColor;
            font-size: 20px;
            line-height: 40px;
            span {
                padding: 0 3px;
            }
        }
        .comments {
            padding-left: 100px;
            margin-top: 8px;
            border-top: 1px solid $activeColor;
            .comment-item:last-child {
                border: none;
                padding-bottom: 0;
            }
        }
        &:not(:last-child) {
            border-bottom: 1px solid $activeColor;
        }
    }
    &.hot-comments {
        .title {
            margin-top: 0;
        }
        .comment-item {
            .comments {
                display: none;
            }
            &.active {
                .comments {
                    display: block;
                }
            }
        }
    }
    .book-comment-form {
        .btn-cancel {
            display: inline-block;
        }
    }
}

.book-sidebar {
    position: absolute;
    width: 200px;
    right: 0;
    top: 130px;
    .book-chapter,
    .book-new {
        li {
            background: $defaultColor;
            list-style: none;
            width: 150px;
            line-height: 30px;
            padding-left: 20px;
            box-sizing: border-box;
            .fa {
                margin-right: 5px;
            }
            .count {
                position: absolute;
                color: $white;
                background-color: $headerBg;
                border-radius: 50%;
                display: inline-block;
                width: 25px;
                height: 25px;
                line-height: 25px;
                text-align: center;
                left: 11px;
                margin-top: 2px;
                font-size: 10px;
                overflow: hidden;
            }
            &.active {
                @include active();
                width: 200px;
                &:hover {
                    width: 200px;
                }
                a {
                    color: $white;
                }
                .count {
                    color: $headerBg; 
                    background-color: $white;
                    left: auto;
                    right: 0;
                }
            }
            &:hover {
                width: 175px;
            }
            &:not(:last-child) {
                border-bottom: 1px solid $activeColor;
            }
        }
    }
    .book-new {
        margin-top: 50px;
        h3 {
            padding-left: 10px;
        }
        li {
            width: 100%;
            padding: 3px 0 3px 20px;
            line-height: 20px;
            a {
                font-size: 14px;
            }
        }
    }
    
    
}

.book-dynamic {
    margin-top: 50px;
    h3 {
        padding-left: 10px;
    }
    dl {
        background: $defaultColor;
        border-bottom: 1px solid $activeColor;
        dt {
            line-height: 30px;
            font-size: 12px;
            a {
                font-size: 16px;
                font-weight: 600;
            }
        }
        dd {
            display: none;
            .book-time {
                text-align: right;
                display: block;
            }
            p {
                margin: 5px 0;
            }
        }
        &:hover {
            dt {
                @include active();
            }
            dd {
                display: block;
            }
        }
    }
}

.book-side-nav {
    li {
        font-size: 12px;
        background: $defaultColor;
        list-style: none;
        width: 150px;
        line-height: 30px;
        border-bottom: 1px solid $activeColor;
        padding-left: 20px;
        box-sizing: border-box;
        &.nav-level-0 {
            font-size: 14px;
            font-weight: 600;
        }
        &.nav-level-1 {
            width: 175px;
            color: $lesscolor;
        }
        &.nav-level-2 {
            color: $lesscolor;
            width: 200px;
        }
        &.active {
            @include active();
            a {
                color: $white;
            }
        }
        &.nav-title {
            text-align: center;
            padding: 0;
            font-size: 16px;
            font-weight: 700;
            border-bottom-width: 3px;
        }
    }
}

.rule-box {
    margin-top: 40px;
    .rule-header {
        text-align: center;
        font-weight: 700;
        b {
            color: $headerBg;
        }
    }
    .rule-tip {
        text-align: center;
        line-height: 40px;
        color: $secondaryFg;
        
    }
    button {
        height: 30px;
        width: 80px;
        background: $secondary;
        color: $headerFg;
        border: 0;
        outline: 0;
    }
    &.rule-login {
        
    }
    &.rule-password {
        text-align: center;
        input {
            height: 30px;
            border: 0;
            outline: 0;
            background: $bg;
            padding: 0 10px;
        }
    }
    &.rule-buy {
        text-align: center;
    }
}

.book-comment-form {
    .title {
        font-size: 20px;
        border-left: 5px solid $activeColor;
        padding-left: 10px;
        margin-top: 15px;
    }
    .form-table {
        display: table;
        width: 100%;
        .form-group {
            display: table-row;
            label {
                line-height: 30px;
                width: 200px;
                display: table-cell;
                text-align: center;
            }
            input,
            select {
                display: table-cell;
                background: transparent;
                border: none;
                border-bottom: 1px solid $activeColor;
                font-size: 20px;
                width: 100%;
            }
        }
    }
    textarea {
        width: 100%;
        height: 100px;
        resize: none;
        background: transparent;
        border: 1px solid $activeColor;
        font-size: 20px;
    }
    button {
        line-height: 30px;
        background: $activeColor;
        padding: 0 20px;
        border: none;
    }
    .btn-cancel {
        display: none;
    }
}

.book-copyright {
    clear: both;
    background-color: #f2f2f2;
    font-size: 12px;
    color: #999;
    padding: 6px 15px 5px;
    border-radius: 2px;
    text-align: center;
    margin-top: 10px;
}

.book-clear {
    clear: both;
}

.footer {
    margin-top: 50px;
    padding: 20px;
    text-align: center;
}

@media screen and (max-width: 1200px) {
    .book-skin {
        width: 100%;
    }
}

@media screen and (max-width: 769px) {
    .book-skin {
        .book-title {
            .book-nav {
                >li {
                    &.book-back {}
                    &.book-navicon {
                        display: inline-block;
                        position: absolute;
                        left: 0;
                        font-size: 30px;
                        padding: 0 10px;
                    }
                    &.book-search {
                        position: relative;
                        left: 0;
                        line-height: 30px;
                        .fa {
                            left: 5px;
                            top: 5px;
                        }
                        input {
                            width: 100%;
                            box-sizing: border-box;
                            display: block;
                            line-height: 30px;
                        }
                        .search-tip {
                            position: static;
                        }
                    }
                    &.active {
                        font-size: 20px;
                        padding-left: 50px;
                        line-height: 34px;
                    }
                }
                &.hover,
                &:hover {
                    >li {
                        display: none;
                        &.active,
                        &.book-navicon {
                            display: inline-block;
                        }
                    }
                }
            }
        }
        .book-body {
            margin-right: 0;
            padding: 30px 8px;
            .book-fork {
                img {
                    width: 100px;
                }
            }
            .book-item {
                margin: 0 -8px;
                padding: 15px 13px 5px;
                dd {
                    display: block;
                    .author,
                    .category,
                    .comment,
                    .agree,
                    .disagree,
                    .click {
                        font-size: 12px;
                    }
                    .agree,
                    .disagree {
                        margin-top: 3px;
                    }
                }
                .book-time {
                    font-size: 12px;
                    width: 70px;
                }
            }
            .info,
            .tools {
                font-size: 12px;
            }
            .content {
                word-wrap: break-word;
                word-break: normal;
                width: 100%;
                display: block;
                position: relative;
                overflow-x: auto;
                * {
                    word-break: normal;
                    width: auto;
                    white-space: pre-wrap;
                    word-wrap: break-word;
                }
            }
        }
        .book-sidebar {
            .book-chapter {
                position: static;
                margin-bottom: 30px;
                width: 100%;
                display: none;
                li {
                    width: 100%;
                    &.active {
                        width: 100%;
                        @include active();
                        &:hover {
                            width: 100%;
                        }
                        a {
                            color: $white;
                        }
                    }
                    &:hover {
                        width: 100%;
                        @include hover();
                        a {
                            color: $white;
                        }
                    }
                }
            }
            .book-dynamic,
            .book-new,
            .book-side-nav {
                display: none;
            }
        }
        .book-footer {
            .book-comments {
                .comment-item {
                    .content {
                        .report,
                        .comment {
                            margin-left: 8px;
                        }
                    }
                    .actions {
                        position: static;
                        width: auto;
                        float: right;
                        line-height: 20px;
                        font-size: 16px;
                    }
                    .time,
                    .floor {
                        font-size: 12px;
                    }
                }
            }
            &.comment {
                margin-right: 0;
            }
        }
        &.book-collapsed {
            .book-title {
                .book-nav {
                    >li {
                        &.book-back {}
                        &.book-navicon {
                            .fa {
                                &:before {
                                    content: "\f00d";
                                }
                            }
                        }
                        &.book-search {
                            display: block;
                            input {
                                display: block;
                            }
                            .search-tip {
                                position: static;
                                display: block;
                            }
                        }
                    }
                    &.hover,
                    &:hover {
                        >li {
                            display: inline-block;
                            &.book-search {
                                display: block;
                            }
                        }
                    }
                }
                &.book-mobile-inline {
                    .book-nav {
                        >li {
                            display: block;
                            line-height: 30px;
                            &.book-back {
                                position: static;
                                font-size: 20px;
                                font-weight: 700;
                                text-align: right;
                                padding-right: 20px;
                            }
                        }
                    }
                }
            }
            .book-body {
                margin-top: 40px;
            }
            .book-sidebar {
                position: static;
                width: 100%;
                .book-chapter {
                    display: block;
                }
            }
        }
    }

    .book-comment-form {
        .form-table {
            .form-group {
                label {
                    width: 100px;
                }
            }
        }
    }
}